package com.study.studyroom.entity.vo.user;

import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import com.study.studyroom.entity.enums.RequestResultEnum;
import com.study.studyroom.entity.exception.GlobalException;
import lombok.Data;
import springfox.documentation.annotations.ApiIgnore;

@Data
public class RegisterVo {

    private String account;
    private String userName;

    private String password;

    private String email;

    private int userType;

    @ApiIgnore
    public void checkParam(){
        if (StringUtils.isBlank(account)){
            throw new GlobalException(RequestResultEnum.NO_ACCOUNT);
        }
        if (StringUtils.isBlank(password)){
            throw new GlobalException(RequestResultEnum.NO_PASSWORD);
        }
        if (userType==0){
            throw new GlobalException(RequestResultEnum.NO_USER_TYPE);
        }
    }

}
